package com.wlt.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wlt.pojo.Orders;
import com.wlt.pojo.SeckillGoods;

public interface SeckillService extends IService<SeckillGoods> {
    
    Page<SeckillGoods> findPageByRedis(int page, int size);
    
    
    SeckillGoods findSeckillGoodsByRedis (Long goodsId);
    
    /**
     * 生成秒杀订单
     * @param orders    秒杀订单数据
     * @return          生成的订单
     */
    Orders createOrder (Orders orders);
    
    /**
     * 查询订单详情
     * @param id    订单id
     * @return      订单详情
     */
    Orders findOrder(String id);
    
    /**
     * 支付秒杀订单
     * @param orderId   订单id
     * @return          订单对象
     */
    Orders pay (String orderId);
    
    /**
     * 将秒杀商品保存到Redis
     * @param seckillGoods  秒杀商品对象
     */
    void addRedisSeckillGoods (SeckillGoods seckillGoods);
    
    /**
     * 从数据库查询秒杀商品详情
     * @param goodsId   商品id
     * @return          秒杀商品详情
     */
    SeckillGoods findSeckillGoodsByMySql (Long goodsId);
    
    
    public void removeFromBlacklist(Long goodsId);
}
